package com.youshang520i.demo;

import com.youshang520i.demo.entity.BeanEntity;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @author youshang
 * @date 2021/03/09 16:35
 **/
@Component
public class MyFactoryBean implements FactoryBean {

    private BeanEntity beanEntity = new BeanEntity();

    @Override
    public Object getObject() throws Exception {
        beanEntity.setClassName("zs");
        return beanEntity;
    }

    @Override
    public Class<?> getObjectType() {
        return beanEntity.getClass();
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
